﻿@using Microsoft.AspNetCore.Mvc.Localization
@using Reborn.IdentityServer4.Admin.UI.Configuration.Constants
@model Reborn.IdentityServer4.Admin.BusinessLogic.Identity.Dtos.Identity.Interfaces.IRoleDto
@inject IViewLocalizer Localizer

@{
    ViewBag.Title = Localizer["Title"];
    Layout = "_Layout";
}

<div class="row">
    <div class="col-12">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a asp-area="@CommonConsts.AdminUIArea" asp-controller="Identity" asp-action="Roles">@Localizer["NavigationRoles"]</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">@Model.Name</li>
            </ol>
        </nav>
    </div>

    <div class="col-12">
        <h2>@Localizer["Title"]</h2>
    </div>
</div>


<form asp-area="@CommonConsts.AdminUIArea" id="client-form" asp-controller="Identity" asp-action="Role" Method="post">

    <div asp-validation-summary="All" class="text-danger"></div>

    @if (!Model.IsDefaultId())
    {
        <!--Button-->
        <div class="form-group row">
            <div class="col-sm-12">
                <a asp-area="@CommonConsts.AdminUIArea" asp-action="RoleClaims" asp-route-id="@Model.Id" class="btn btn-outline-primary">
                    <span class="oi oi-plus"></span> @Localizer["ActionAddClaims"]
                </a>
                <a asp-area="@CommonConsts.AdminUIArea" asp-action="RoleUsers" asp-route-id="@Model.Id" class="btn btn-primary"> @Localizer["ActionRoleUsers"]</a>
                <a asp-area="@CommonConsts.AdminUIArea" asp-action="RoleDelete" asp-route-id="@Model.Id" class="btn btn-danger"> @Localizer["ActionDeleteRole"]</a>
            </div>
        </div>
    }

    <!--Hidden -->
    <input type="hidden" asp-for="Id"/>
    <div class="card mt-3">
        <h5 class="card-header">@Localizer["Title"]</h5>
        <div class="card-body">

            <!--Input - text -->
            <div class="form-group row">
                <label asp-for="Name" class="col-sm-3 col-form-label">
                    @await Html.PartialAsync("Role/Section/Label", "RoleName")
                </label>
                <div class="col-sm-9">
                    <input type="text" required class="form-control" asp-for="Name">
                    <span asp-validation-for="Name" class="text-danger"></span>
                </div>
            </div>

            <!--Button-->
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">
                </label>
                <div class="col-sm-9">
                    <button type="submit" class="btn btn-primary">@Localizer["ActionSaveRole"]</button>
                </div>
            </div>
        </div>
    </div>
</form>